# 二进制文件的读取和写入

# rb表示二进制的读取
with open("aa.gif","rb") as f:
    with open("aa_copy.gif","wb") as w:
        for line in f.readlines():
            w.write(line)

print("图片拷贝完成.........")

with open("read.txt","r",encoding="utf-8") as f:
    print("文件名是：{0}".format(f.name))
    print(f.tell()) #返回文件指针的当前位置
    print("读取的内容：{0}".format(str(f.readline())))
    print(f.tell())
    f.seek(0,0) # 相当于从头开始读取了
    print("读取的内容：{0}".format(str(f.readline())))